package com.hdax.dm.controller;

import com.hdax.dm.dto.ScheDto;
import com.hdax.dm.dto.SeatDto;
import com.hdax.dm.service.SchedulerSeatSevrice;
import com.hdax.dm.service.SchedulerService;
import com.hdax.dm.utils.response.CommonResponse;
import com.hdax.dm.utils.response.ResponseUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(path = "/choose/seat")
public class SeatController {
    @Autowired
    private SchedulerSeatSevrice schedulerSeatSevrice;
    @Autowired
    private SchedulerService schedulerService;

    @PostMapping(path = "/getSeatList")
    public CommonResponse<SeatDto> getSeatList(@RequestBody Map<String,String> map){
        String id = map.get("scheduleId");

        return ResponseUtils.returnSuccess(schedulerSeatSevrice.seatList(id));
    }


    @PostMapping(path = "/getSchedule")
    public CommonResponse<ScheDto> getSchedule(@RequestBody Map<String,String> map){
        String id = map.get("scheduleId");
        return ResponseUtils.returnSuccess(schedulerService.scheDtos(id));
    }
}
